﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using PSE.Communication.Fix.Common;
using PSE.Communication.Fix.Server.Session;

namespace PSE.Communication.Fix.Server.FixProxy
{
    public partial class FixProxyService : ServiceBase
    {
        SessionManager _sessionManager;

        public FixProxyService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            try
            {
                _sessionManager = SessionManager.GetInstance();

                _sessionManager.Start();
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
                this.Stop();
            }
        }

        protected override void OnStop()
        {
            if (_sessionManager != null)
                _sessionManager.Stop();
        }
    }
}
